package com.lexed.carmanager.database;

import java.io.InputStream;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class MybatisApplication {
	
	private static SqlSessionFactory sqlSessionFactory;
	
	
	static{
		InputStream is =
				MybatisApplication.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
		
		sqlSessionFactory = 
				new SqlSessionFactoryBuilder().build(is);
		
		
	}
	
	public static SqlSession openSession(){
		return sqlSessionFactory.openSession(true);
	} 
	
	

}
